<template>
    <div>
        {{count}}
        <button @click="increment">
            按钮
        </button>
        <button @click="() => this.$store.commit('decrease')">
            减少
        </button>
        {{anoCount}}
    </div>
</template>
<script>
import { mapState } from 'vuex'

export default {
    methods: {
        increment() {
            this.$store.commit('increment')
            console.log(this.$store.state.count)
        }
    },
    computed: {
        count() {
            return this.$store.state.count + 1
        },
        ...mapState({
            anoCount: state => state.anotherCount
        })
    },
}
</script>
